<script>
import { getInfo } from '@/api/api-user'
	export default {
		onLaunch: function() {
			console.log('App Launch')

      // console.log(uni.getStorageSync('foa-user-token'), this.$store.state.user.token)

      // 从本地缓存中取出token
      this.$store.state.user.token = uni.getStorageSync('foa-user-token')
      // 获取用户信息
      getInfo().then(data => {
        console.log(data)
        let user = data.user
        this.$store.state.user.username = user.userName
        this.$store.state.user.userId = user.userId
        this.$store.state.user.email = user.email
        this.$store.state.user.avatar = user.avatar
        this.$store.state.user.deptId = user.deptId
        this.$store.state.user.nickName = user.nickName
        this.$store.state.user.roles = user.roles
        this.$store.state.user.permissions = data.permissions
      })
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
  @import "./static/app-iconfont/iconfont.css";
	@import "./uni_modules/vk-uview-ui/index.scss";
	@import "./static/flowable-iconfont/iconfont.css";

</style>
